<script type="text/javascript">
function tip(id)
{
	if(id==1)
	{
		document.getElementById("tipnav").style.display="block";
	}
	if(id==2)
	{
		document.getElementById("tipnav").style.display="none";
	}
}

$(document).ready(function(){
  $("#tipnav").mouseleave(function(){
      document.getElementById("tipnav").style.display="none";
  });
});

function onclickclose()
{
	document.getElementById("tipnav").style.display="none";
}
/*
function tip1()
{
$("tipnav").mouseleave(function(){
	 alert("test");
	document.getElementById("tipnav").style.display="none";
	});	
/*	
$("#tipnav").bind("mouseleave",
function()
{
		document.getElementById("tipnav").style.display="none";
}
);
}*/
</script>

<?php 
$sj=date('Y-m-d H:i:s');
//获取推荐人信息
if($_SESSION["tjr"]==NULL)
{
	$_SESSION["tjr"]=$_GET["rec"]; 
}
//判断是否二级页面
$navheadurl="";
if($tag=="center"||$tag=="fxb"||$tag=="cha"){
  $navheadurl="../";
}
$hcookieusername = $_COOKIE['ddusername']; 
$hcookiepassword = $_COOKIE['ddpassword']; $hnum=0;
if($hcookieusername<>NULL&&$_SESSION["duoduouser"]==NULL)
{	
	$hq = "SELECT * FROM ".$BIAOTOU."user where ddusername='".$hcookieusername."' and ddpassword='".$hcookiepassword."'";
	$hrs = mysql_query($hq);
	$hnum = mysql_num_rows($hrs);
	
	if($hnum!=0)
	{   
		while($row = mysql_fetch_object($hrs)) 
		{
			$_SESSION["dduserid"] = $row->Id;
			$_SESSION["dduserlevel"] = $row->dengji; 
		} 		
		$hsj= date("Y-m-d H:i:s");
		$hq = "update ".$BIAOTOU."user set loginnum=loginnum+1 ,lastlogintime='$sj' where ddusername='".$hcookieusername."'";	
		mysql_query($hq);
		$_SESSION["duoduouser"] = $hcookieusername; 			 
	}
}

if($_SESSION["duoduouser"]!=NULL){
	$sql="select * from ".$BIAOTOU."user where ddusername='".$_SESSION["duoduouser"]."'";
	$urs = mysql_query($sql);
	while($urow = mysql_fetch_object($urs)) 
	{
		$money=round($urow->money,2); 
		if($money<0)
			$money=0;
		$dengji=$urow->dengji; 
		$_SESSION["dduserlevel"] = $dengji; 
		$txsj=$urow->lasttixian; 
		$txstate=$urow->txstate;
		$jifen=$urow->jifen;
	}

	mysql_query("set names utf8");	
	$hsql="select id from ".$BIAOTOU."msg where ddusername='".$_SESSION["duoduouser"]."' and see=0";
	$hrs = mysql_query($hsql);
	$msgnum = mysql_num_rows($hrs);
}
?>
<div class="head_warp">
	<div class="layout_head">
        <div class='slideup'>
            <ul class="headerTopLeft">
                <li class="home"><a href="index.php" onmousemove="tip(1);" >优米库首页</a></li>
                <li><a href="<?=$navheadurl?>comm/shortcut.php">放到桌面</a></li>
                <li><a href="#dd" onClick="AddFavorite('<?=$navheadurl?>','<?=WEBNICK?>')">添加到收藏夹</a></li>
                <li><a href="<?=$navheadurl?>user/msg_list.php?act=send">咨询优助手</a></li>
                <li><a href="<?=$navheadurl?>user/msg_list.php?act=send">提意见给客服</a></li>
            </ul>
            <ul class="headerTopRight FRight" style="margin-right:50px;width:400px">
                <li class="HUserimg"><img src="upload/avatar/<?=get_avatar_filepath($_SESSION['dduserid'], $size = 'big')?>" width="40" height="40"></li>
                <li><a href="<?=$navheadurl?>user/center.php">我的优米库</a></li> 
                <?php
                if($_SESSION["duoduouser"]==NULL)
                {
					echo "<li><a href=\"".$navheadurl."user/register.php\">成为米粒</a></li>";
                    echo "<li><a href=\"".$navheadurl."user/login.php\">登录</a></li>";
                    echo "<li><a href=\"".$navheadurl."user/center.php\">您好，游客".$_SESSION["tmpuser"]."</a></li>";
                }
                else
                {
                    echo "<li><a href=\"".$navheadurl."user/exit.php\">退出</a></li>";
                    echo "<li><a href=\"".$navheadurl."user/center.php\">您好，".$_SESSION["duoduouser"]."</a></li>";	
                }
                ?>
            </ul>
            <div class="clears"></div>
        </div> 
        <div class="search">
            <?php if($modtag=="malllist"){?>
               <a class='logo' href='malllist.php'><img src='template/<?=MOBAN?>/images/logo_red.png'></a>
            <?php }?>
            <?php if($modtag=="shoplist"){?>
               <a class='logo' href='shoplist.php'><img src='template/<?=MOBAN?>/images/logo_taobao.gif'></a>
            <?php }?>
            <?php if($modtag=="bblist"){?>
               <a class='logo' href='baobeilist.php'><img src='template/<?=MOBAN?>/images/logo_baobei.gif'></a>
            <?php }?>
            <form  name="formname" target="_blank" method="get" action="<?=$navheadurl?>view.php" style="float:left; ">
            <input type="hidden" name="search" value="1" />
            <input name="q" onfocus="this.value='';" type="text" id="s-txt" value="输入您想要的淘宝商品网址" class='qword' style="color:#c7c3c3">
            <input type="submit" name="button" value="" class="ssubmit">
            </form>
        </div>
         
        <div class='nav'>
            <span class='l'><a href='<?=$navheadurl?>malllist.php' <?php if($modtag=="malllist"){echo "class=active";} ?>>返米店铺</a><a href='<?=$navheadurl?>shoplist.php' <?php if($modtag=="shoplist"){echo "class=active";} ?>>淘宝店铺</a><a href='#'>米票店铺</a><a href='#'>订单店铺</a></span>
            <a href='<?=$navheadurl?>baobeilist.php' <?php if($modtag=="bblist"){echo "class=active";} ?>>米粒晒吧</a><a href='<?=$navheadurl?>huan.php'>用米兑换</a><a href='#'>提交订单</a><a href='#'>米票兑换</a><a href='<?=$navheadurl?>user/tuiguang_url.php'>免费攒米</a><!--<a href='#'>返米宝</a>--><a href='#'>优米联盟</a>
        </div>
	</div>
    
    <div class="dhmenu" id="tipnav" onblur="onclickclose();" style="display:none">
        <div class="fm">
        <a class="active">攒米</a><a href='malllist.php'>返米店铺</a><!--<a href='#'>返米宝</a>--><a href='user/tuiguang_url.php'>免费攒米</a><!--<a href='#'>省钱检测</a>--><a class="active">兑换</a><a href="huan.php">用米兑换</a><a href="user/tixian.php">申请提现</a>
        <a href='#' class="active">社区</a><a href='baobeilist.php'>米粒晒吧</a>
        <br /><a class="active">店铺</a><a href='#'>优米联盟</a>
       </div>
   </div> 

</div>
 
